SG VersionInfo Contents

Stinga SG VersionInfo |
SG VersionInfo | © 1998 by Stinga.

The SG VersionInfo is ActiveX™ component that exposes version information stored in Windows executables and fonts through the rich set of properties and methods. This information can be used to perform various administrative tasks or build installation scripts. Component is small (<100kB) and does not need any external DLLs.

This demo version is 100% functional but from time to time it will display registration remainder dialog box. On-line registration is available at www.stinga.com.

  • Properties
  • Methods
  • Examples
  • FAQ
  • Bug Report
  • Order
  • Legal Info


FAQ

Stinga SG VersionInfo |
FAQ | © 1998 by Stinga.

  • What is SG VersionInfo?

SG VersionInfo is ActiveX™ component that can be used to access version information stored in the files that have Windows resources, such as a dynamic-link libraries (DLL), an executable files, or a font files. This information can be used to perform various administration tasks or build installation scripts.

  • On which platforms does it run?

SG VersionInfo runs on Windows 95/98(TM) and Windows NT 4.0(TM).

  • How can I install it?

Just run SETUP.EXE.

  • Can I purchase source code?

Yes. Check our prices and order it here.

  • Can I use it on my Web pages?

Yes, you can use VBScript or JScript to automate SG VersionInfo object.

  • How can I order SG Version Info?

Online orders are available at Stinga WWW site

  • Can I redistribute it with my products?

Yes. SG VersionInfo is royalty free. If you are registered user, you can redistribute binary code without any restrictions. You can not distribute source code. If you are going to change source code and build new binaries, you should change GUIDs and name of the executable. This is necessary to avoid versioning problems.


License Agreement

Stinga SG VersionInfo |
License Agreement | © 1998 by Stinga.

PLEASE READ THE FOLLOWING LICENSE AGREEMENT. IT WILL BE NECESSARY FOR YOU TO AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT BEFORE BEING PERMITTED TO CONTINUE TO DOWNLOAD AND/OR INSTALL THE PRODUCT.

LICENSE AGREEMENT FOR STINGA SOFTWARE:

VERY IMPORTANT - READ CAREFULLY: This Stinga Software License Agreement (hereinafter "LICENSE") is a legal agreement between you (either an individual or a single entity) and Stinga (hereinafter "STINGA"), for the SOFTWARE or products on this web site, and may include "on-line" or electronic documentation (hereinafter "SOFTWARE"). By installing and/or using the SOFTWARE, you agree to be bound by the terms of this LICENSE. If you do not agree to the terms of this LICENSE, do not download and/or use SOFTWARE from STINGA.

SOFTWARE LICENSE

Copyright laws and international copyright treaties, as well as other intellectual property laws and treaties protect the SOFTWARE. The SOFTWARE is licensed, not sold.

I. LICENSE GRANTS. This LICENSE grants you the following rights:
A. You may use one copy of the STINGA SOFTWARE identified above on a single computer. The SOFTWARE is in "use" on a computer when it is loaded into temporary memory (i.e. RAM) or installed into permanent memory (e.g. hard disk, CD-ROM, or other storage devise) of that computer. However, installation on a network server for the sole purpose of internal distribution to one or more other computer(s) shall not constitute "use" for which a separate license is required, provided you have a separate license for each computer to which the SOFTWARE is distributed.

B. Solely with respect to electronic documents included with the SOFTWARE, you may make a copy (either in hardcopy or electronic form), provided that the number of copies made shall not exceed the number of licenses you own for that SOFTWARE, and further provided that such copies shall be used only for internal purposes and are not republished or distributed to any third party.

II. TITLE; COPYRIGHT.
All title and copyrights in and to the SOFTWARE (including but not limited to any images, photographs, animation, video, audio, music, text and "applets" incorporated into the SOFTWARE), the accompanying printed materials, and any copies of the SOFTWARE are owned by STINGA or its suppliers. Copyright laws and international treaty provisions protect the SOFTWARE. Therefore, you must treat the SOFTWARE like any other copyrighted material, except that you may either (A) make one copy of the SOFTWARE solely for backup or archival purposes or (B) install the SOFTWARE on a single computer provided you keep the original solely for backup or archival purposes.

III. ADDITIONAL RIGHTS AND LIMITATIONS.

A. No Separation of Components. The SOFTWARE is licensed as a single product and the software programs comprising the SOFTWARE may not be separated for use by more than one user at a time.

B. Rental. You may not rent or lease the SOFTWARE.

C. Software Transfer. You may NOT transfer any of your rights under this LICENSE.

D. Termination. Without prejudice to any other rights, STINGA may terminate this LICENSE if you fail to comply with the terms and conditions of this LICENSE. In such event, you must destroy all copies of the SOFTWARE.

IV. REDISTRIBUTABLE COMPONENTS.
A. Source Code and Sample Code. In addition to the license granted in Section 1, STINGA grants you the right to use and modify the source code versions of those portions of the SOFTWARE which are identified in the documentation as the Source Code and Sample Code of the SOFTWARE, either on disk, CD-ROM or electronic format (collectively "SOURCE CODE") provided you comply with section 4.c. You may NOT distribute the SOURCE CODE, or any modified version of the SOURCE CODE, in source code form.
B. Redistributable Code. In addition to the license granted in Section 1, STINGA grants you a nonexclusive, royalty-free right to reproduce and distribute the object code version of those portions of the SOFTWARE designated in the SOFTWARE as (I) those portions of the SOFTWARE which are identified in the documentation as the OCX ("OCX") Controls; and (II) those portions of the SOFTWARE which are identified in the documentation as REDISTRIBUTABLE DLLs ("DLLs"), provided you comply with Section 4.c.
C. Redistribution Requirements. If you redistribute the REDISTRIBUTABLES, you agree to (I) distribute the REDISTRIBUTABLES in object code form only in conjunction with and as part of your software application product which adds significant and primary functionality and which is designed, developed, and tested to operate in the Microsoft Windows and/or Windows NT environments; (II) not use STINGA's name, logo or trademarks to market your software application product; (III) include a valid copyright notice on your SOFTWARE; (IV) indemnify, hold harmless, and defend STINGA from and against any claims or lawsuits, including attorney's fees, that arise or result from the use and distribution of your software application product; and (V) not permit further distribution of the REDISTRIBUTABLES by your end user.

V. CROATIAN LAW.
Croatian copyright law description is described under paragraphs (NN53/91) and (NN58/93) defines software copyrights with sanction against violator described in subparagraph (95) and (96) and penalties for violators described in subparagraph (101) (103) and (103b). Croatian law can prosecute all violators by Croatian law and violator's domicile state law. Manufacturer is STINGA, Branimirova 97 Zagreb 10000 Croatia.

LIMITED WARRANTY

LIMITED WARRANTY. EXCEPT WITH RESPECT TO REDISTRIBUTABLES, WHICH ARE PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, STINGA WARRANTS THAT THE SOFTWARE WILL PERFORM SUBSTANTIALLY IN ACCORDANCE WITH THE ACCOMPANYING WRITTEN MATERIALS FOR A PERIOD OF THIRTY (30) DAYS FROM THE DATE OF RECEIPT. SOME STATES AND JURISDICTIONS DO NOT ALLOW LIMITATIONS OF DURATION OF AN IMPLIED WARRANTY, SO THE ABOVE LIMITATION MAY NOT APPLY TO YOU. TO THE EXTENT ALLOWED BY APPLICABLE LAW, IMPLIED WARRANTIES ON THE SOFTWARE, IF ANY, ARE LIMITED TO THIRTY (30) DAYS.

CUSTOMER REMEDIES. STINGA'S AND ITS SUPPLIERS' ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL BE, AT STINGA'S OPTION, EITHER

(A) RETURN OF THE PAID PRICE, OR (B) REPAIR OR REPLACEMENT OF THE SOFTWARE. PRODUCTS PURCHASED OTHER THAN DIRECTLY FROM STINGA SHALL BE RETURNED THROUGH THE RESELLER FROM WHICH IT WAS PURCHASED. THIS LIMITED WARRANTY IS VOID IF FAILURE OF THE SOFTWARE HAS RESULTED FROM ACCIDENT, ABUSE, OR MISAPPLICATION. ANY REPLACEMENT SOFTWARE WILL BE WARRANTED FOR THE REMAINDER OF THE ORIGINAL THIRTY (30) DAY PERIOD.

NO OTHER WARRANTIES. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, STINGA AND ITS SUPPLIERS DISCLAIM ALL OTHER WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH REGARD TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO STATE/JURISDICTION.

NO LIABILITIES FOR CONSEQUENTIAL DAMAGES. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL STINGA OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF STINGA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES AND JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.

LICENSEE ACKNOWLEDGES THAT IT HAS READ AND UNDERSTANDS THIS AGREEMENT AND AGREES TO BE BOUND BY ITS TERMS. LICENSEE FURTHER AGREES THAT THIS AGREEMENT IS THE COMPLETE AND EXCLUSIVE STATEMENT OF THE AGREEMENT BETWEEN LICENSEE AND LICENSOR, AND SUPERCEDES ANY PROPOSAL OR PRIOR AGREEMENT, ORAL OR WRITTEN, AND ANY OTHER COMMUNICATIONS RELATING TO THE SUBJECT MATER OF THIS AGREEMENT.


Ordering Info

Stinga SG VersionInfo |
Ordering | © 1998 by Stinga

For online orders visit our WWW site at www.stinga.com


Properties

Stinga sgVersionInfo |
Properties | © 1998 by Stinga.

Path As String

Returns or sets modules full file path. Changing Path property automaticaly updates Language and Codepage values.

InfoExist As Boolean

Returns True if file object contain valid version info, i.e. file specified in Path property is successfully opened.

LanguageName As String

Returns a description string for the language associated with current version data

Language As Integer

Returns or sets language for which version data is retrived. This property is standard language identifier. For a list of language identifiers click here. Changing Path property automaticaly updates Language property.

Codepage As Integer

Returns or sets character set for which version data is retrived. This property is standard codepage identifier and list of codepage identifiers. Changing Path property automaticaly updates Codepage property.

FileVersionHigh As Long

Returns the most significant 32 bits of the file's binary version number. This number is used with FileVersionLow to form a 64-bit value used for numeric comparisons.

FileVersionLow As Long

Returns the least significant 32 bits of the file's binary version number. This number is used with FileVersionHigh to form a 64-bit value used for numeric comparisons.

ProductVersionHigh As Long

Returns the most significant 32 bits of the binary version number of the product with which this file was distributed. This number is used with ProductVersionLow to form a 64-bit value used for numeric comparisons

ProductVersionLow As Long

Returns the least significant 32 bits of the binary version number of the product with which this file was distributed. This number is used with ProductVersionHigh to form a 64-bit value used for numeric comparisons

FileFlagsMask As Long

Contains a bitmask that specifies the valid bits in FileFlags property. For a list of valid flags look at FileFlags property documenatation.

FileFlags As Long

Contains a bitmask that specifies the Boolean attributes of the file. This member can include one or more of the following values:

Flag

Value

Description

sgVS_FF_DEBUG | 1 | The file contains debugging information or is compiled with debugging features enabled.
sgVS_FF_INFOINFERRED | 2 | The file's version structure was created dynamically; therefore, some of the members in this structure may be empty or incorrect.
sgVS_FF_PATCHED | 4 | The file has been modified and is not identical to the original shipping file of the same version number.
sgVS_FF_PRERELEASE | 8 | The file is a development version, not a commercially released product.
sgVS_FF_PRIVATEBUILD | 16 | The file was not built using standard release procedures.
sgVS_FF_SPECIALBUILD | 32 | The file was built by the original company using standard release procedures but is a variation of the normal file of the same version number.

FileOS As Long

Specifies the operating system for which this file was designed. This member can be one of the following values:

Flag

Value

Description

sgVOS_DOS | 65536 | The file was designed for MS-DOS.
sgVOS_OS216 | 131072 | The file was designed for 16-bit OS/2.
sgVOS_OS232 | 196608 | The file was designed for 32-bit OS/2.
sgVOS_NT | 262144 | The file was designed for Windows NT.
sgVOS__WINDOWS16 | 1 | The file was designed for 16-bit Windows.
sgVOS__PM16 | 2 | The file was designed for 16-bit Presentation Manager.
sgVOS__PM32 | 3 | The file was designed for 32-bit Presentation Manager.
sgVOS__WINDOWS32 | 4 | The file was designed for the Win32 API.
sgVOS_UNKNOWN | 0 | The operating system for which the file was designed is unknown to Windows.

An application can combine these values to indicate that the file was designed for one operating system running on another.

FileOSString As String

Returns text presentation of the operating system for which this file was designed. This property can have one of these values

FileType As Long

Returns the general type of file. Can be one the folowing values:

Flag

Value

Description

sgVFT_UNKNOWN

0

The file type is unknown to Windows.

sgVFT_APP

1

The file contains an application.

sgVFT_DLL

2

The file contains a dynamic-link library (DLL).

sgVFT_DRV

3

The file contains a device driver. FileSubtype contains a more specific description of the driver.

sgVFT_FONT

4

The file contains a font. FileSubtype contains a more specific description of the font file.

sgVFT_VXD

5

The file contains a virtual device.

sgVFT_STATIC_LIB

7

The file contains a static-link library.

FileSubtype As Long

Returns the function of the file. The possible values depend on the value of FileType property. For all values of FileType not described in the following list, value of the FileSubtype property is zero.

If FileType is sgVFT_DRV, FileSubtype can be:

Flag

Value

Description

sgVFT2_UNKNOWN | 0 | The driver type is unknown by Windows.
sgVFT2_DRV_PRINTER | 1 | The file contains a printer driver.
sgVFT2_DRV_KEYBOARD | 2 | The file contains a keyboard driver.
sgVFT2_DRV_LANGUAGE | 3 | The file contains a language driver.
sgVFT2_DRV_DISPLAY | 4 | The file contains a display driver.
sgVFT2_DRV_MOUSE | 5 | The file contains a mouse driver.
sgVFT2_DRV_NETWORK | 6 | The file contains a network driver.
sgVFT2_DRV_SYSTEM | 7 | The file contains a system driver.
sgVFT2_DRV_INSTALLABLE | 8 | The file contains an installable driver.
sgVFT2_DRV_SOUND | 9 | The file contains a sound driver.
sgVFT2_DRV_COMM | 10 | The file contains a communications driver.

If FileType is sgVFT_FONT, FileSubtype can be:
Flag Value

Description

sgVFT2_UNKNOWN | 0 | The font type is unknown by Windows.
sgVFT2_FONT_RASTER | 1 | The file contains a raster font.
sgVFT2_FONT_VECTOR | 2 | The file contains a vector font.
sgVFT2_FONT_TRUETYPE | 3 | The file contains a TrueType font.

FileDate As Date

Returns the file's creation date and time stamp

Comments As String

Contains any additional information that should be displayed for diagnostic purposes. This string can be an arbitrary length.

CompanyName As String

Returns name of the company that produced the file

FileDescription As String

Describes the file in such a way that it can be presented to users. This string may be presented in a list box when the user is choosing files to install. For example, "Stinga VersionInfo Object".

FileVersion As String

Returns the version number of the file.

InternalName As String

Returns the internal name of the file.

LegalCopyright As String

Describes all copyright notices, trademarks, and registered trademarks that apply to the file.

LegalTrademarks As String

Describes all trademarks and registered trademarks that apply to the file

OriginalFilename As String

Identifies the original name of the file, not including a path. This enables an application to determine whether a file has been renamed by a user.

PrivateBuild As String

Describes by whom, where, and why this private version of the file was built. This string should only be present if the VS_FF_PRIVATEBUILD flag is set in the FileFlags property.

ProductName As String

Identifies the name of the product with which this file is distributed.

ProductVersion As String

Identifies the version of the product with which the file is distributed

SpecialBuild As String

Describes how this version of the file differs from the normal version. This entry should only be present if the VS_FF_SPECIALBUILD flag is set in the FileFlags property.


Methods

Stinga SG VersionInfo |
Methods | © 1998 by Stinga.

GetValue

The GetValue method retrieves version info value associated with specified key and name. If block specified with key or value specified with name does not exist, GetValue returns empty string.

Syntax:

GetValue(key As String, name As String) As String

key

Name of the version info block. This value can be one of predefined strings ("VarFileInfo", "StringFileInfo") or name of any user defined version info block.

name

Name of the value inside block named key. There are several predefined value names:

CompanyName FileDescription FileVersion InternalName LegalCopyright OriginalFilename ProductName ProductVersion Comments LegalTrademarks PrivateBuild SpecialBuild

Value names are not restricted to predefined ones. Any modul can have user defined blocks and values.


Constants

Stinga sgVersionInfo |
Constants | © 1998 by Stinga.

sgFileFlag constants:

Flag

Value

Description

sgVS_FF_DEBUG | 1 | The file contains debugging information or is compiled with debugging features enabled.
sgVS_FF_INFOINFERRED | 2 | The file's version structure was created dynamically; therefore, some of the members in this structure may be empty or incorrect.
sgVS_FF_PATCHED | 4 | The file has been modified and is not identical to the original shipping file of the same version number.
sgVS_FF_PRERELEASE | 8 | The file is a development version, not a commercially released product.
sgVS_FF_PRIVATEBUILD | 16 | The file was not built using standard release procedures.
sgVS_FF_SPECIALBUILD | 32 | The file was built by the original company using standard release procedures but is a variation of the normal file of the same version number.

sgFileOS constants

Flag

Value

Description

sgVOS_DOS | 65536 | The file was designed for MS-DOS.
sgVOS_OS216 | 131072 | The file was designed for 16-bit OS/2.
sgVOS_OS232 | 196608 | The file was designed for 32-bit OS/2.
sgVOS_NT | 262144 | The file was designed for Windows NT.
sgVOS__WINDOWS16 | 1 | The file was designed for 16-bit Windows.
sgVOS__PM16 | 2 | The file was designed for 16-bit Presentation Manager.
sgVOS__PM32 | 3 | The file was designed for 32-bit Presentation Manager.
sgVOS__WINDOWS32 | 4 | The file was designed for the Win32 API.
sgVOS_UNKNOWN | 0 | The operating system for which the file was designed is unknown to Windows.

sgFileType constants

Flag

Value

Description

sgVFT_UNKNOWN

0

The file type is unknown to Windows.

sgVFT_APP

1

The file contains an application.

sgVFT_DLL

2

The file contains a dynamic-link library (DLL).

sgVFT_DRV

3

The file contains a device driver. FileSubtype contains a more specific description of the driver.

sgVFT_FONT

4

The file contains a font. FileSubtype contains a more specific description of the font file.

sgVFT_VXD

5

The file contains a virtual device.

sgVFT_STATIC_LIB

7

The file contains a static-link library.

sgFileSubtype constants

Flag

Value

Description

sgVFT2_UNKNOWN | 0 | The driver type is unknown by Windows.
sgVFT2_DRV_PRINTER | 1 | The file contains a printer driver.
sgVFT2_DRV_KEYBOARD | 2 | The file contains a keyboard driver.
sgVFT2_DRV_LANGUAGE | 3 | The file contains a language driver.
sgVFT2_DRV_DISPLAY | 4 | The file contains a display driver.
sgVFT2_DRV_MOUSE | 5 | The file contains a mouse driver.
sgVFT2_DRV_NETWORK | 6 | The file contains a network driver.
sgVFT2_DRV_SYSTEM | 7 | The file contains a system driver.
sgVFT2_DRV_INSTALLABLE | 8 | The file contains an installable driver.
sgVFT2_DRV_SOUND | 9 | The file contains a sound driver.
sgVFT2_DRV_COMM | 10 | The file contains a communications driver.
sgVFT2_UNKNOWN | 0 | The font type is unknown by Windows.
sgVFT2_FONT_RASTER | 1 | The file contains a raster font.
sgVFT2_FONT_VECTOR | 2 | The file contains a vector font.
sgVFT2_FONT_TRUETYPE | 3 | The file contains a TrueType font.


SG VersionInfo Errors

Stinga SG VersionInfo |
Error Codes | © 1998 by Stinga.

Error Code | Description
1001 | File name is not specified. Occurs when requesting info from the VersionInfo object and file name was not specified.


EnumFiles

Stinga SG VersionInfo |
Enumerate Files | © 1998 by Stinga.

This VBScript enumerates files from the system directory and prints version information for files that have it. You will need WSH to run this example.

' Create objects
set VerInfo = WScript.CreateObject("sgVersionInfo.VersionInfo")
Set fs = WScript.CreateObject("Scripting.FileSystemObject")
Set foldr = fs.GetFolder(WScript.Path)

On Error Resume Next
Dim sMsg
Dim vbCrLf
vbCrLf = Chr(13) + Chr(10)

' Are we running from command line
Dim bFromCmdLine
bFromCmdLine = false
if InStrRev(UCase(WScript.FullName), "CSCRIPT") then bFromCmdLine = true

' Scan all files in the folder
For Each File In foldr.Files

    ' Try to get version info for current file
    VerInfo.Path = File.Path
    if Err.Number = 0 then
        ' No error. Display version info if file contains any
        if VerInfo.InfoExist then
            sMsg = UCase(file.Name) + " - " + VerInfo.FileDescription + vbCrLf
            sMsg = sMsg + "Product Name: " + VerInfo.ProductName + vbCrLf
            sMsg = sMsg + "File Version: " + VerInfo.FileVersion + vbCrLf
            sMsg = sMsg + "Product Version: " + VerInfo.ProductVersion + vbCrLf
            sMsg = sMsg + "Company Name: " + VerInfo.CompanyName + vbCrLf
            sMsg = sMsg + "Internal Name: " + VerInfo.InternalName + vbCrLf
            sMsg = sMsg + "Original Filename: " + VerInfo.OriginalFilename + vbCrLf
            sMsg = sMsg + "Private Build: " + VerInfo.PrivateBuild + vbCrLf
            sMsg = sMsg + "Special Build: " + VerInfo.SpecialBuild + vbCrLf
            sMsg = sMsg + "Legal Copyright: " + VerInfo.LegalCopyright + vbCrLf
            sMsg = sMsg + "Legal Trademarks: " + _
                  VerInfo.GetValue("StringFileInfo", "LegalTrademarks") + vbCrLf
            sMsg = sMsg + "Language: " + VerInfo.LanguageName + vbCrLf
            sMsg = sMsg + "Comments: " + VerInfo.Comments + vbCrLf
            sMsg = sMsg + "OS: " + VerInfo.FileOSString + vbCrLf

            if bFromCmdLine then
                WScript.Echo sMsg
            else
                rc = MsgBox(sMsg, 1)
                if rc = 2 then WScript.Quit(0)
            end if
        end if
    else
        ' Somethig went wrong
        sMsg = file.Name + ": " + Err.Decription
        if bFromCmdLine then
            WScript.Echo sMsg
            MsgBox file.Name + ": " + Err.Decription
        else
            MsgBox sMsg
        end if
        Err.Clear
    end if
next

set VerInfo = nothing
Set fs = nothing
Set foldr = nothing

You can find several sample programs and scripts in the Samples subfolder of the SGVersionInfo installation folder.


HTML Example

Stinga sgVersonInfo |
HTML Example | © 1998 by Stinga

If you click here, SG VersionInfo will show version info resource data from the file.

NOTE: For this example to work you must open it with ActiveX enabled browser and SG VersionInfo component should have been installed.

You can find several sample programs and scripts in the Samples subfolder of the SGVersionInfo installation folder.


FindVerInfo

Stinga sgVersonInfo |
FindVerInfo | © 1998 by Stinga

FindVerInfo Finds files which have specified string in the version information

Syntax

FindVerInfo path verinfo_name value

path - folder to be searched
verinfo_name - name of the version item to search
value - value to search for

Source code for this script follows:

On Error Resume Next
Dim sKey, sValue, sInfo, sMsg
Dim vbCrLf
vbCrLf = Chr(13) + Chr(10)

' Check arguments
if WScript.Arguments.Count <> 3 then
    WScript.Echo "Invalid command line. Expected: " + vbCrLf + _
                 "FindVerInfo path verinfo_name value"
    WScript.Quit(0)
end if

sKey = WScript.Arguments(1)
sValue = WScript.Arguments(2)

' Create some objects
set VerInfo = WScript.CreateObject("sgVersionInfo.VersionInfo")
Set fs = WScript.CreateObject("Scripting.FileSystemObject")
Set foldr = fs.GetFolder(WScript.Arguments(0))

' Are we running from command line
Dim bFromCmdLine
bFromCmdLine = false
if InStrRev(UCase(WScript.FullName), "CSCRIPT") then
   bFromCmdLine = true
end if

' Scan all files in the folder
For Each File In foldr.Files

    ' Try to get version info for current file
    VerInfo.Path = File.Path
    if Err.Number = 0 then

        ' No error. Get specified info and see
        ' if specified value is in it
        if VerInfo.InfoExist then
            sInfo = VerInfo.GetValue("StringFileInfo", sKey)
            if InStr(sInfo, sValue) > 0 then
                sMsg = file.Name + Chr(9) + VerInfo.FileVersion + _
                       Chr(9) + VerInfo.FileDescription
                if bFromCmdLine then
                    WScript.Echo sMsg
                else
                    rc = MsgBox(sMsg, 1)
                    if rc = 2 then WScript.Quit(0)
                end if
            end if
        end if
    else
        ' Somethig went wrong
        sMsg = file.Name + ": " + Err.Decription
        if bFromCmdLine then
            WScript.Echo sMsg
            MsgBox file.Name + ": " + Err.Decription
        else
            MsgBox sMsg
        end if
        Err.Clear
    end if
next

set VerInfo = nothing
Set fs = nothing
Set foldr = nothing

You can find several sample programs and scripts in the Samples subfolder of the SGVersionInfo installation folder.